home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual Basic 5 / Mastering Microsoft Visual Basic 5.ISO / demo code / ch05 / passstring / frmmain.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-01-07  |  1.2 KB  |  38 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    Caption         =   "String Passing"
  4.    ClientHeight    =   1620
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   3270
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1620
  10.    ScaleWidth      =   3270
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton cmdWinDir 
  13.       Caption         =   "&Get Windows Directory"
  14.       Default         =   -1  'True
  15.       Height          =   630
  16.       Left            =   570
  17.       TabIndex        =   0
  18.       Top             =   480
  19.       Width           =   2055
  20.    End
  21. Attribute VB_Name = "frmMain"
  22. Attribute VB_GlobalNameSpace = False
  23. Attribute VB_Creatable = False
  24. Attribute VB_PredeclaredId = True
  25. Attribute VB_Exposed = False
  26. Private Declare Function GetWindowsDirectory Lib "kernel32" _
  27.   Alias "GetWindowsDirectoryA" _
  28.   (ByVal lpBuffer As String, _
  29.   ByVal nSize As Long) As Long
  30. Private Sub cmdWinDir_Click()
  31.   Dim WinDir As String
  32.   Dim ReturnSize As Long
  33.   WinDir = String(255, 0)
  34.   ReturnSize = GetWindowsDirectory(WinDir, Len(WinDir))
  35.   WinDir = Left$(WinDir, ReturnSize)
  36.   MsgBox "The Windows directory is: " & WinDir
  37. End Sub
  38.